Skip to content

Hotfix/project member invite case sensitive #325

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 2, 2019

Conversation

vikasrohit
Copy link

Dev version of hotifx

vikasrohit added 2 commits June 4, 2019 17:46
…_field_project_estimations

Added quantity field for project estimations as we need to store quantity for API add ons as of new API smart forms
@vikasrohit vikasrohit requested a review from maxceem July 2, 2019 08:53
@vikasrohit vikasrohit merged commit f9c89f5 into dev Jul 2, 2019
Copy link
Contributor

@maxceem maxceem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vikasrohit I've tested it locally it works for new invitations.

Just want to note, that this fix wouldn't work for the old invitations which have been created before this fix. As inside ES index and DB we already can have invitations with email in one shape, while the user could use another shape during registration.
So if we imagine, that user invitation has been already sent with upper-case, and the user now is registering with lowercase after the fix:
1. I don't see a project I'm invited to in the list. Most likely because ES search for projects with invitation using case-sensitive query: https://github.com/topcoder-platform/tc-project-service/blob/hotfix/project_member_invite_case_sensitive/src/routes/projects/list.js#L145
2. When I try to directly access the project I'm invited to by link, I don't have permissions to access the project also.

Also, there is a couple of comments to make sure we are safe in the future.
One is commented below.
And another one: there is another method getProjectInvitesForUser which also gets invitations for a user but for all projects.
We either should update it the same way or remove it, as I cannot find any use case of this second method I think it would be better to remove it.

_.assign(where, { $or: [
{ email: { $eq: email.toLowerCase() } },
{ userId: { $eq: userId } },
] });
} else if (email) {
_.assign(where, { email });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vikasrohit It looks like we also have to fix this line even though currently we don't use this method with email only for now, but we can do in the future theoretically.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, sure. I would do the change in dev branch directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants